package com.nwpu.am.mapper;

import com.github.pagehelper.Page;
import com.nwpu.am.pojo.dto.page.KnowledgePageDTO;
import com.nwpu.am.pojo.entity.Knowledge;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;


@Mapper
public interface KnowledgeMapper {
    @Insert("INSERT INTO tb_knowledge (knowledge_id, type, description) VALUES (#{knowledgeId}, #{type}, #{description})")
    int insertKnowledge(Knowledge knowledge);
    @Select("SELECT * FROM tb_knowledge WHERE knowledge_id = #{knowledgeId}")
    Knowledge selectKnowledgeById(long knowledgeId);
    @Delete("DELETE FROM tb_knowledge WHERE knowledge_id = #{knowledgeId}")
    int deleteKnowledgeById(long knowledgeId);
    @Select("SELECT * FROM tb_knowledge")
    Page<Knowledge> pageQuery(KnowledgePageDTO knowledgePageDTO);
    @Select("SELECT * FROM tb_knowledge WHERE type = 0")
    ArrayList<Knowledge> selectPremiseKnowledge();
    @Select("SELECT * FROM tb_knowledge WHERE type = 1")
    ArrayList<Knowledge> selectConclusionKnowledge();
    int update(Knowledge knowledge);
}

